1. Technical Field
The present invention is directed generally to the data processing field, and, more particularly, toward a method and system for interleaving first and second halves of a data segment of unknown length.
2. Description of the Related Art
A need exists in the data processing field to split a segment of data in half and then interleave the two halves together. For example, in a disk drive, read/write channels have the need to handle even and odd bits in parallel and use independent circuits in order to meet timing and power goals. To allow for this parallel even and odd data operation, even and odd data interleaves in the data stream are often required in order to have independent and often proprietary codings applied. These codings are better applied at a slower clock rate on a data path pipeline that is multiple bits wide, for example, 32 bits wide, and a mechanism is needed to separate the even and odd interleaves in such a data path for the purpose of applying such a coding.
Consider a segment of data that consists of N bits that are divided into N/S symbols, wherein S is symbol size in number of bits and N/S is an integer that can be bounded by a maximum constant value. The segment size N is based on the particular application, and ideally S has a relationship with the data path that interfaces to the circuit. For example, if a data path is 10 bits wide, it is convenient to choose a symbol size S that is either equal to 10 or is an integer multiple of 10. Consider also the interleave granularity K, which determines how many continuous bits are taken at a time from each half in order to perform the interleave. K can be any integer factor of S except S itself. If S is 10 bits, for example, K can be 1, 2 or 5.
As an example, consider a data segment having a length N=20 bits and a symbol size S=10 bits. The data segment thus has N/S=2 symbols. If the 20 bits of the data segment are designated a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t; splitting the data segment into two halves provides the following two data segment halves:
First half: a, b, C, d, e, f, g, h, i, j
Second half: k, l, m, n, o, p, q, r, s, t.
If the two halves are interleaved using K=5, the data bits will be arranged as follows:
a, b, c, d, e, k, l, m, n, o, f, g, h, i, j, p, q, r, s, t.
If the two halves are interleaved using K=2, the data bits will be arranged as follows:
a, b, k, l, c, d, m, n, e, f, o, p, g, h, q, r, i, j, s, t.
If the two halves are interleaved using K=1, the data bits will be arranged as follows:
a, k, b, l, c, m, d, n, e, o, f, p, g, q, h, r, i, s, j, t.
Consider an application in which the data bits must be interleaved within a data path pipeline that continuously takes S bits in and S bits out, and in which multiple input data segments are received concatenated together and multiple output interleaved data segments are transmitted concatenated together with no gaps in the pipeline. Also consider that N can be a variable in units of S for each of the data segments that are received, and that the actual value of N is not known until an indication occurs indicating that a given input symbol is the last symbol of the input data segment. N can, however, be bounded by a maximum value to assist in sizing structures used in the interleaving procedure. In such an application, a mechanism is needed to interleave the first and second halves of a data segment based on the above constraints.